/* 
 * File:   XshareLine.h
 * Author: minaev
 *
 * Created on 31 Октябрь 2013 г., 9:45
 */

#ifndef XSHARELINE_H
#define	XSHARELINE_H

#include <stdint.h>
#include "Xmsg.h"

class XshareLine {
public:
    XshareLine(uint8_t blockLen,uint16_t startLen);
    virtual ~XshareLine();
    void* read(uint16_t nblock);
    void write(void* buf, uint16_t len, uint16_t offset);
    int addBlock(const void* block);
    int addBlockWithoutRepeate(const void* block);
    int findBlock(const void* block);
    int removeBlock(uint16_t nblock);
    int removeBlock(void* block);
    int cmpBlock(const void* block,uint16_t nblock); 
    uint8_t getBlockLen();
    uint16_t getLength();
    uint32_t getBytesLength();
    char* toBytes();
private:
    uint8_t* lineMem; //point to memory line
    uint8_t blockLen; //length of one block into lineMem
    uint16_t length;  //length of lineMem (in blocks)
};

#endif	/* XSHARELINE_H */

